package com.lmx.repoDomain.tmodel;

import io.katharsis.resource.annotations.JsonApiIncludeByDefault;
import io.katharsis.resource.annotations.JsonApiResource;
import io.katharsis.resource.annotations.JsonApiToOne;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * 资料类型
 *
 * @author ytche
 * @date 2017年7月21日
 *
 */
@JsonApiResource(type = "documentType")
@Entity
@Table(name = "tnb_document_type")
public class DocumentType extends BaseEntity {
	private static final long serialVersionUID = 1L;
	private String name;
	private DocumentType parent;
	private Integer level;

	@Column(name = "name")
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@JsonApiToOne
	@JsonApiIncludeByDefault
	@ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.REFRESH)
	@JoinColumn(name = "parent_id")
	public DocumentType getParent() {
		return parent;
	}

	public void setParent(DocumentType parent) {
		this.parent = parent;
	}

	@Column(name = "level")
	public Integer getLevel() {
		return level;
	}

	public void setLevel(Integer level) {
		this.level = level;
	}
}
